<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title></title>
	 <link rel="stylesheet" type="text/css" href="<%=basePath%>js/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>js/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/demo.css">
	<script type="text/javascript" src="<%=basePath%>js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/jquery.easyui.min.1.2.2.js"></script>
	<script>
		
		function productFormatter(value){
			for(var i=0; i<products.length; i++){
				if (products[i].productid == value) return products[i].name;
			}
			return value;
		}
		$(function(){
			var lastIndex;
			$('#tt').datagrid({
				
				onBeforeLoad:function(){
					$(this).datagrid('rejectChanges');
				},
				onClickRow:function(rowIndex){
					if (lastIndex != rowIndex){
						$('#tt').datagrid('endEdit', lastIndex);
						$('#tt').datagrid('beginEdit', rowIndex);
					}
					lastIndex = rowIndex;
				}
			});
		});
	
		function deleteTeam(id){
			if(window.confirm("确认删除吗 ?")){
				window.location.href="<%=basePath%>deleteTeam.action?id="+id;
			}
		
		}
		
		function updateTeam(id){
			parent.addTab("修改","<%=basePath%>findByTeam.action?id="+id,"icon");
		}
		
		
	</script>
</head>
<body>
		<table id="tt" style="width:200px;height:auto"
			title="客户分组表 " iconCls="icon-edit" singleSelect="true"
			>
		<thead>
			<tr>
				<th width="100"  align="center">分组ID</th>
				<th  width="100"  align="center" formatter="productFormatter">客户姓名</th>
				<th width="50" align="center">修改</th>
				<th width="60" align="center">删除</th>
			</tr>
			 
			    <s:iterator value="teamList" id="topic">
					<tr>
						<th><s:property value="#topic.vid"/></th>
						<th><s:property value="#topic.teamName"/></th>
						<th><a href="javascript:updateTeam(<s:property value="#topic.vid"/>);">修改</a></th>
						<th><a href="javascript:deleteTeam(<s:property value="#topic.vid"/>)">删除</a></th>
				</tr> 
				</s:iterator>
		</thead>
	</table>
</body>
</html>